home *** CD-ROM | disk | FTP | other *** search
- 10 ' PROGRAM SPIROPLOT
- 20 '
- 30 ' Randy D. Ralph
- 40 ' 33 West Devonshire Street
- 50 ' Winston-Salem, NC 27107
- 60 ' (919) 788-4591
- 70 '
- 80 ' PLEASE KEEP ME INFORMED OF ANY IMPROVEMENTS YOU MAY MAKE. THANKS.
- 90 '
- 100 ' PRAD = Radius of the plotting circle as a decimal fraction.
- 110 ' It is converted to pixel units.
- 120 ' SRAD = Radius of the static circle in pixel units.
- 130 ' PPOINT = Points on the plotter --> converts to radial increment PINC.
- 140 ' SPOINT = Points on the stator ---> converts to radial increment SINC.
- 150 ' PI = The value of 2 * pi.
- 160 ' FRACT = The fraction of PRAD to use when plotting.
- 170 '
- 180 ' EXPERIMENT WITH NEGATIVE NUMBERS AND FRACTIONS FOR SOME INTERESTING
- 190 ' RESULTS.
- 200 '
- 210 ' ********************** INPUT ROUTINE ***********************
- 220 '
- 230 CLS
- 240 PRINT TAB(30);"PROGRAM SPIROPLOT"
- 250 PRINT
- 260 PRINT
- 270 PRINT TAB(30);"by Randy D. Ralph"
- 280 FOR X=1 TO 10:PRINT:NEXT X
- 290 PRINT
- 300 INPUT "DO YOU NEED INSTRUCTIONS (Y/N)? ",ANS$
- 310 IF ANS$="y" OR ANS$="Y" THEN 1910
- 320 KEY (1) ON
- 330 ON KEY (1) GOSUB 1710
- 340 CLS
- 350 PRINT "PRESS F1 TO STOP THE PLOTTING AND BEGIN ANOTHER FIGURE."
- 360 PRINT
- 370 PRINT "ENTER ZERO TO EXIT THE PROGRAM"
- 380 PRINT
- 390 PRINT
- 400 PRINT " 1 -----> 320 x 200 2 -----> 640 x 200"
- 410 PRINT
- 420 INPUT "Enter your screen resolution: ",RES
- 430 IF RES=0 THEN 1870
- 440 IF RES <1 OR RES >2 THEN 340
- 450 ON RES GOTO 460,810
- 460 XDIM=319/2:YDIM=199/2
- 470 F=1 ' CORRECTION FACTOR FOR WIDTH
- 480 C=.5' CORRECTION FACTOR FOR SCREEN SIZE
- 490 D=2 ' CORRECTION FACTOR FOR CENTER
- 500 PRINT
- 510 PRINT "LINE COLOR PALETTE 0 PALETTE 1"
- 520 PRINT
- 530 PRINT " 1 GREEN CYAN"
- 540 PRINT
- 550 PRINT " 2 RED BROWN"
- 560 PRINT
- 570 PRINT " 3 BROWN WHITE"
- 580 PRINT
- 590 INPUT "SELECT PALETTE: ",PAL
- 600 PRINT
- 610 INPUT "SELECT LINE COLOR: ",COL
- 620 IF PAL <0 OR PAL >1 THEN 580
- 630 IF COL <1 OR COL >3 THEN 580
- 640 CLS
- 650 PRINT " 0 - BLACK 1 - BLUE 2 - GREEN 3 - CYAN 4 - RED"
- 660 PRINT
- 670 PRINT
- 680 PRINT " 5 - MAGENTA 6 - BROWN 7 - WHITE 8 - GRAY 9 - LT. BLUE"
- 690 PRINT
- 700 PRINT
- 710 PRINT "10 - LG. GRN. 11 - LT. CY. 12 - LT. RED 13 - LT. MAG. 14 - YELLOW"
- 720 PRINT
- 730 PRINT
- 740 PRINT "15 - HIGH INTENSITY WHITE"
- 750 PRINT
- 760 PRINT
- 770 PRINT
- 780 INPUT "SELECT BACKGROUND COLOR: ",BACK
- 790 IF BACK<0 OR BACK>15 THEN 750
- 800 GOTO 850
- 810 XDIM=639/2:YDIM=199/2
- 820 F=2 ' CORRECTION FACTOR FOR WIDTH
- 830 C=1 ' CORRECTION FACTOR FOR SCREEN SIZE
- 840 D=1 ' CORRECTION FACTOR FOR CENTER
- 850 CLS
- 860 SCREEN 0,0
- 870 PRINT
- 880 INPUT "Radius of PLOTTER: ",PRAD
- 890 PRINT
- 900 INPUT "FRACTION to use: ",FRACT
- 910 PRINT
- 920 INPUT "Points on STATOR: ",SPOINT
- 930 PRINT
- 940 INPUT "Points on PLOTTER: ",PPOINT
- 950 PRINT
- 960 INPUT "OK (Y/N <cr> = Y)? ",OK$
- 970 IF OK$="N" OR OK$="n" THEN 850
- 980 '
- 990 '************************ CHECK INPUT **************************
- 1000 '
- 1010 IF PRAD >1 OR PRAD <-1 THEN 1020 ELSE 1080
- 1020 PRINT
- 1030 PRINT "A PLOTTING RADIUS >1 OR <-1 WILL PRODUCE A FIGURE LARGER THAN THE"
- 1040 PRINT "TOTAL AREA AVAILABLE ON SCREEN!"
- 1050 PRINT
- 1060 INPUT "DO YOU REALLY WANT TO DO THIS (Y/N)? ",ANS$
- 1070 IF ANS$ ="n" OR ANS$="N" THEN 850
- 1080 IF PRAD=0 THEN 1090 ELSE 1140
- 1090 PRINT
- 1100 PRINT "OH, COME ON! A PLOTTER RADIUS OF ZERO JUST MAKES A CIRCLE!"
- 1110 PRINT
- 1120 INPUT "PRESS ENTER TO CLEAR ERROR",X$
- 1130 GOTO 850
- 1140 IF SPOINT=PPOINT THEN 1150 ELSE 1210
- 1150 PRINT
- 1160 PRINT "OH, COME ON! IF THE PLOTTER AND STATOR POINTS ARE EQUAL THAT JUST"
- 1170 PRINT "MAKES A CIRCLE!"
- 1180 PRINT
- 1190 INPUT "PRESS ENTER TO CLEAR ERROR",X$
- 1200 GOTO 850
- 1210 IF SPOINT = 0 OR PPOINT = 0 THEN 1220 ELSE 1270
- 1220 PRINT
- 1230 PRINT "OH, COME ON! BOTH CIRCLES HAVE TO HAVE PLOTTING POINTS!"
- 1240 PRINT
- 1250 INPUT "PRESS ENTER TO CLEAR ERROR",X$
- 1260 GOTO 850
- 1270 IF FRACT>1 OR FRACT<-1 THEN 1280 ELSE 1340
- 1280 PRINT
- 1290 PRINT "IF THE FRACTION OF THE PLOTTER RADIUS TO USE IS >1 OR <-1 THE"
- 1300 PRINT "FIGURE WILL GO OFF SCREEN!"
- 1310 PRINT
- 1320 INPUT "DO YOU REALLY WISH TO DO THIS (Y/N)? ",ANS$
- 1330 IF ANS$="n" OR ANS$="N" THEN 850
- 1340 IF FRACT=0 THEN 1350 ELSE 1440
- 1350 PRINT
- 1360 PRINT "OH, COME ON! IF THE FRACTION OF THE PLOTTER RADIUS TO USE IS ZERO"
- 1370 PRINT "THAT JUST DRAWS A CIRCLE!"
- 1380 PRINT
- 1390 INPUT "PRESS ENTER TO CLEAR ERROR",X$
- 1400 GOTO 850
- 1410 '
- 1420 '***************** INITIALIZE AND PLOT ******************
- 1430 '
- 1440 CLS
- 1450 ON RES GOTO 1460,1490
- 1460 SCREEN 1,0
- 1470 COLOR BACK,PAL
- 1480 GOTO 1500
- 1490 SCREEN 2,0,0
- 1500 N=0
- 1510 PI=2*3.141593
- 1520 PRAD=YDIM*PRAD*2
- 1530 SRAD=(YDIM*2)-PRAD
- 1540 PRAD=PRAD*FRACT
- 1550 PINC=PI/PPOINT
- 1560 SINC=PI/SPOINT
- 1570 A=A+SINC
- 1580 N=N+1
- 1590 B=B+PINC
- 1600 X=((SIN(A)*SRAD)+XDIM*D)*C
- 1610 Y=((COS(A)*SRAD/F)+YDIM*D)*C
- 1620 X1=(COS(B)*PRAD)*C
- 1630 Y1=(SIN(B)*PRAD/F)*C
- 1640 X=X+X1
- 1650 Y=Y+Y1
- 1660 IF N=1 THEN 1670 ELSE 1680
- 1670 LINE (X,Y)-(X,Y),COL
- 1680 LINE -(X,Y),COL
- 1690 GOTO 1570
- 1700 '
- 1710 '******************** RESTORE ALPHA SCREEN AND REDO *******************
- 1720 '
- 1730 INPUT "PRESS ENTER",X$
- 1740 CLS
- 1750 SCREEN 0,0
- 1760 WIDTH 80
- 1770 GOTO 320
- 1780 RETURN
- 1790 '
- 1800 '*********************** EXIT PROGRAM ****************
- 1810 '
- 1820 SCREEN 0,0
- 1830 WIDTH 80
- 1840 GOTO 1870
- 1850 RETURN
- 1860 '*******************************************************
- 1870 PRINT
- 1880 PRINT "HOPE YOU HAD FUN!"
- 1890 PRINT
- 1900 GOTO 2280
- 1910 '
- 1920 '******************** INSTRUCTIONS *****************
- 1930 CLS
- 1940 PRINT "This program emulates a Spirograph. It will produce interesting rosettes"
- 1950 PRINT "on the screen in either medium resolution color graphics mode or high"
- 1960 PRINT "resolution black and white graphics mode. The parameters you input will"
- 1970 PRINT "determine the form of the rosette, background color and line color."
- 1980 PRINT
- 1990 PRINT "Parameters on screen color and resolution are self-explanatory. You will"
- 2000 PRINT "be asked to enter the radius of the plotting circle. This is equivalent to"
- 2010 PRINT "the disc you place inside the drawing ring and determines its size"
- 2020 PRINT "relative to the ring. It MUST be a positive or negative fraction in the"
- 2030 PRINT "range -1 to 1. If you choose a value of zero a circle will result! Next"
- 2040 PRINT "You will be asked to specify the fraction of the radius of this disc to use"
- 2050 PRINT "when plotting. This is equivalent to selecting the hole in the disc you"
- 2060 PRINT "would place your pen in. The value must be less than 1 and greater than -1."
- 2070 PRINT "Values outside this range will produce rosettes larger than the screen and a"
- 2080 PRINT "value of zero draws a circle. You will then be asked to indicate the number"
- 2090 PRINT "of points on the plotting circle and the static circle. Obviously, a number"
- 2100 PRINT "of zero is silly. Experiment with these parameters. They determine the"
- 2110 PRINT "number of tesselations the rosette will have and can produce some very"
- 2120 PRINT "peculiar and beautiful results when negative numbers and fractions are used."
- 2130 PRINT
- 2140 INPUT "PRESS ENTER",X$
- 2150 CLS
- 2160 PRINT "GOOD LUCK! and have fun. Please report any improvements to:
- 2170 PRINT
- 2180 PRINT" Randy D. Ralph"
- 2190 PRINT " 33 West Devonshire Street"
- 2200 PRINT " Winston-Salem, NC 27107"
- 2210 PRINT " (919) 788-4591"
- 2220 PRINT
- 2230 PRINT "Thanks!"
- 2240 PRINT
- 2250 INPUT "PRESS ENTER TO CONTINUE ",X$
- 2260 GOTO 320
- 2270 '******************************************************************
- 2280 END
-